package club.easin.sq.ctl;

import club.easin.common.DatagridRequestDto;
import club.easin.pow.dto.UserSession;
import club.easin.sq.bl.Inmatebl;
import club.easin.sq.dto.CheckDto;
import club.easin.sq.dto.InmateQueryDto;
import club.easin.sq.dto.SqInmateTemp;
import club.easin.utils.ReturnDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("inmate")
public class InmateCtl {

    @Autowired
    private Inmatebl inmatebl;

    @RequestMapping("inmategrild")
    @ResponseBody
    public ReturnDto getInmateGrild(UserSession userSession,@RequestBody DatagridRequestDto<InmateQueryDto> dto){
        return inmatebl.getInmateGrild(dto);
    }

    @RequestMapping("addinmate")
    @ResponseBody
    public ReturnDto addInmate(UserSession userSession, @RequestBody SqInmateTemp sqInmateTemp){
        return inmatebl.addInmate(userSession,sqInmateTemp);
    }

    @RequestMapping("addinmatecheck")
    @ResponseBody
    public ReturnDto checkInmate(UserSession userSession,CheckDto checkDto){
        return inmatebl.inmateCheck(userSession,checkDto);
    }
    @RequestMapping("editInmate")
    @ResponseBody
    public ReturnDto editInmate(UserSession userSession,@RequestBody SqInmateTemp sqInmateTemp){
        return inmatebl.editInmate(userSession,sqInmateTemp);
    }

    @RequestMapping("updateCheck")
    @ResponseBody
    public ReturnDto updateCheck(UserSession userSession,CheckDto checkDto){
        return inmatebl.updateInmateCheck(userSession,checkDto);
    }

    @RequestMapping("inmateTempGrild")
    @ResponseBody
    public ReturnDto inmateTempGrild(UserSession userSession,@RequestBody DatagridRequestDto<InmateQueryDto> dto){
        return inmatebl.getInmateTempGrild(dto);
    }

    @RequestMapping("getInmatebyid")
    @ResponseBody
    public ReturnDto getInmateBykey(UserSession userSession,String inmateid){
        return inmatebl.getInmateBykey(inmateid);
    }

    @RequestMapping("getinmatetemp")
    @ResponseBody
    public ReturnDto getInmatetemp(UserSession userSession,String tempid){
        return inmatebl.getInmateTempByid(tempid);
    }

    @RequestMapping("getinmateBycode")
    @ResponseBody
    public ReturnDto getInmateBycode(UserSession userSession,String code){
        return inmatebl.getInmateByidcode(code);
    }


}
